package com.qf.web.common.qo;


import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


@Data
@Validated
public class MemberRequestParams {
    public static final String VALID_CONSTANT_USERNAME = "^[a-zA-Z][a-zA-Z0-9]{5,16}$";
    public static final String VALID_CONSTANT_USERNAME_MSG = "用户名格式不正确,必须是字母开头长度为6-16";

    public interface Add {

    }

    public interface Update {

    }
    
    @Min(value = 1, groups = {Update.class}, message = "ID不能为空")
    private Long memberId;
    @NotNull
    @Pattern(regexp = VALID_CONSTANT_USERNAME, message = VALID_CONSTANT_USERNAME_MSG)
    private String username;
    @NotNull
    @Pattern(regexp = "^[A-Z][a-zA-Z0-9]{5,20}$", message = "用户名格式不正确,必须是字母开头长度为6-16")
    private String password;
    private String nickname;
    @NotNull
    @Pattern(regexp = "^1[3-9][0-9]{9}$", message = "手机号格式不正确!")
    private String phone;
    private String email;
    private String icon;
    @Valid
    private Address address;

}
